using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Common;
using Net.SourceForge.WURFL.Core;
namespace Roaming.view
{
    public partial class help : System.Web.UI.Page
    {
        protected int cols = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            string strUA = Request.Headers["USER-AGENT"].ToString();
            if (strUA.ToLower().Contains("opera"))
            {
                if (Request.Headers["X-OperaMini-Phone-UA"] != null)
                    strUA = Request.Headers["X-OperaMini-Phone-UA"].ToString();
            }
            cols = DAL.getColLinkSite(strUA);
            if (cols > 2)
            {
                cols = 3;
            }
        }

        protected void Submit_Click(object sender, EventArgs e)
        {
            
            string Name = txtName.Text.Trim();
            string Tel = txtTel.Text.Trim();
            string Email = txtEmail.Text.Trim();
            string Subject = txtSubject.Text.Trim();
            string Message = txtMessage.Text.Trim();
            if ((Message != "") || (Subject != ""))
            {
                string SQL = string.Format("EXEC tblContact_Insert '{0}','{1}','{2}','{3}','{4}'", Name, Tel, Email, Subject, Message);
                DataSet ds = DAL.GetDataSet(SQL);
                if (ds !=null)
                    {
                        lblContact.Visible = true;  
                      lblContact.Text = "Infomations sent. Thank you!";
                    }
                else
                    {
                        lblContact.Visible = true;
                    lblContact.Text = "Infomations contact sent fail!";             
                }
            }
        }

        protected void Reset_Click(object sender, EventArgs e)
        {
            //txtName.Text = "";
            //txtTel.Text = "";
            //txtEmail.Text = "";
            //txtEmail.Text = "";
            //txtSubject.Text = "";
            //txtMessage.Text = "";
            ////RequiredFieldValidator1.Visible = false;
            
            //lblContact.Visible = false;
            Response.Redirect("/view/help.html");
        }
    }
}
